/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package SYSGEST.br.UndSaude;

import java.util.ArrayList;
import java.util.List;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author Mesopotanea
 */
public class UndSaudeModel extends AbstractTableModel{
    
     List<UndSaude> undSaude = new ArrayList<UndSaude>();
   private String[] undSaudecolunas = {"Codigo","Codigo ESF", "Unidade de Saúde", "Endereço"};
    
    
    public UndSaudeModel(List <UndSaude> undSaude){
        this.undSaude.clear();
        this.undSaude.addAll(undSaude);
    }

    

    @Override
    public int getRowCount() {
        return undSaude.size();
    }

    @Override
    public int getColumnCount() {
        return undSaudecolunas.length;
    }

  
    

    @Override
   public Object getValueAt(int rowIndex, int columnIndex){
       UndSaude undSaudes = undSaude.get(rowIndex);
       switch(columnIndex){
           case 0:
               return undSaudes.getCodigo();
            case 1:
               return undSaudes.getCodpsf();
           case 2: 
               return undSaudes.getUnidade();
           case 3:
               return undSaudes.getEnd();
       }
       return null;
   }
    @Override
       public String getColumnName(int column){
           
          switch(column){
           case 0:
               return undSaudecolunas[0];
           case 1: 
               return undSaudecolunas[1];
           case 2:
               return undSaudecolunas[2];
           case 3:
               return undSaudecolunas[3];
       }
          return null;
       }
    
    
}
